***REPLICATION README FILE

TITLE: Adding measurement error to location data to protect subject confidentiality while allowing for consistent estimation of exposure effects
JOURNAL: The Journal of the Royal Statistical Society: Series C (Applied Statistics)

Mahesh Karra, David Canning, Ryoko Sato
February 29, 2020

DATA FILES:
-DATA_1_WOMAN_GPS_2_29_20.dta: Contains data on women's GPS coordinates and health facility GPS coordinates.
-DATA_2_ARUSHA_GRID_GPS_2_29_20.dta: Contains data on the population density in each grid from where the woman and health facility data are obtained.


SETUP INSTRUCTIONS:
0.1 Save all files in the same folder. 
0.2 Copy the filepath where the files are saved.
0.3 Open both do files, DO_FILE_1_HF_DIST_2_29_20.do and DO_FILE_2_DIST_SIMULATION_2_29_20.do
0.4 Replace the filepath in quotations on line 19 of each do file with your filepath where the replication files are stored.

SIMULAITON INSTRUCTIONS
STEP 1. Run DO_FILE_1_HF_DIST_2_29_20.do to calculate the distance from each grid point across the space to the health facility in the data.

STEP 2. Run DO_FILE_2_DIST_SIMULATION_2_29_20.do to calculate the following; 
[1] Create (1) perturbed distances from actual distances (dist5_e`s'), and (2) create the fixed distances from the perturbed distances (log: E_min_dg_i_`j') ( 1 replication )
[2] Run a regression of the subjective distance on actual distance.
[3] Run a regression of the subjective distance on the perturbed distance (1 replication , generate random perturbation <5km)
[4] Run a regression of the subjective distance on corrected distance


FOR QUESTIONS, CONTACT THE CORRESPONDING AUTHOR:
Mahesh Karra
Assistant Professor of Global Development Policy
Frederick S. Pardee School of Global Studies
Boston University
E-mail: mvkarra@bu.edu
Phone: +1-617-358-0197